package com.jsfcompref.solutech.backing;

import java.util.List;

import javax.faces.component.UIData;

import com.eCommerce.corecontract.criteria.UserCriteria;
import com.eCommerce.corecontract.dto.Role;
import com.eCommerce.corecontract.exception.EcommerceException;
import com.eCommerce.server.corebackend.util.BackEndConstants;
import com.eCommercecorecontract.svco.IUserSVCO;
import com.eCommercecorecontract.svco.SVCOFinder;
import com.ecommerceWeb.common.ServiceFinder;

public class ListClients {

	public ListClients() {
		super();
		// TODO Auto-generated constructor stub
	}

	private UIData data = null;

	public UIData getData() {
		return data;
	}

	public void setData(UIData data) {
		this.data = data;
	}

		public List getClients() {
		List listOfclient = null;
		try {
			SVCOFinder sVCOFinder = (SVCOFinder) ServiceFinder
					.findBean("SVCOFinder");
			IUserSVCO userSVCO = (IUserSVCO) sVCOFinder
					.get(BackEndConstants.SVCO_USER);
			UserCriteria userCriteria = new UserCriteria();
			userCriteria.setRole(Role.CLIENT.toString());
			listOfclient = userSVCO.rechercherUsers(userCriteria);//();

		} catch (EcommerceException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return listOfclient;
	}
}
